package com.garden.springcloud.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.garden.springcloud.project.entity.User;
import com.garden.springcloud.project.mapper.UserMapper;
import com.garden.springcloud.project.query.UserQuery;
import com.garden.springcloud.project.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;
    public List<User> getUser() {
        return userMapper.getUser();
    }

    public IPage<User> getUsers(UserQuery query) {
        Page<User> userPage1 = new Page<User>();
        userPage1.setCurrent(query.getPageNo());
        Page<User> userPage = userMapper.selectPage(userPage1, new QueryWrapper<User>());

        return userPage;
    }

}
